package cubelabs.nexus.utils;

import java.util.ArrayList;
import java.util.List;

import cubelabs.nexus.domain.UserDTO;
import cubelabs.nexus.entity.User;

public class GenericUtils {

	public static UserDTO getUserDTO(User user){
		UserDTO userDTO = new UserDTO();
		userDTO.setActive(user.isActive());
		userDTO.setId(user.getId());
		userDTO.setEmail(user.getEmail());
		userDTO.setEmailValidated(user.isEmailValidated());
		userDTO.setLastLogin(user.getLastLogin());
		userDTO.setName(user.getName());
		userDTO.setImagePath(user.getImagePath());
		return userDTO;
	}
	
	public static List<UserDTO> getUserDTO(List<User> userList){
		List<UserDTO> userDTOs = null;
		if(userList != null && userList.size() > 0){
			userDTOs = new ArrayList<UserDTO>();
			for(User user: userList){
				userDTOs.add(getUserDTO(user));
			}
		}
		return userDTOs;
	}
}
